<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/


get_config_keytable("date_plan_Increase");
empty($do) && $do = 'list';
if ($do == 'list') {
	include_once('template/add.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$title = getGP('title','P');
	$content = getGP('content','P');
	$startdate = getGP('startdate','P')." ".getGP('starth','P').":".getGP('starti','P').":00";
	$enddate = getGP('enddate','P')." ".getGP('endh','P').":".getGP('endi','P').":00";
	$otype = getGP('otype','P');
	$department = getGP('department','P');
	$participation = getGP('participation','P');
	$person = getGP('person','P');
	$note = getGP('note','P');
	$date = get_date('Y-m-d h:i:s',PHP_TIME);
	$type = getGP('type','P');
	$uid=$_USER->id;
	
	
	//主表信息
	$plan = array(
		'title' => $title,
		'content' => $content,
		'startdate' => $startdate,
		'enddate' => $enddate,
		'otype' => $otype,
		'department' => $department,
		'participation' => $participation,
		'person' => $person,
		'note' => $note,
		'date' => $date,
		'type' => $type,
		'uid' => $uid,
	);
	//写入主表信息
	insert_db('plan',$plan);
	$id=$db->insert_id();
	
	//发送提示信息
	//短消息
	if(getGP('sms_info_box_person','P')!=''){
	$content=$person.':您有一个计划需要执行,计划主题为：'.$title.';请进行处理!<a href="admin.php?ac=views&fileurl=plan&id='.$id.'">点击查看>></a>';
	//接收人；内容；类型（1：有返回回值;0：无返回值）;URL
	SMS_ADD_POST($person,$content,0,0,$_USER->id);
	}
	//手机短信
	if(getGP('sms_phone_box_person','P')!=''){
	$content=$person.':您有一个计划需要执行,请登录OA进行处理!';
	PHONE_ADD_POST(getGP('personphone','P'),$content,$person,0,0,$_USER->id);
	}
	//////////////////////////////////////////////////
	if(getGP('sms_info_box_participation','P')!=''){
	$content=$participation.':您有一个计划需要执行,计划主题为：'.$title.';请进行处理!<a href="admin.php?ac=views&fileurl=plan&id='.$id.'">点击查看>></a>';
	//接收人；内容；类型（1：有返回回值;0：无返回值）;URL
	SMS_ADD_POST($participation,$content,0,0,$_USER->id);
	}
	//手机短信
	if(getGP('sms_phone_box_participation','P')!=''){
	$content=$participation.':您有一个计划需要执行,请登录OA进行处理!';
	PHONE_ADD_POST(getGP('participationphone','P'),$content,$participation,0,0,$_USER->id);
	}
	
	
	$content=$title.get_inc_log(1).$content.get_inc_log(1).$startdate.get_inc_log(1).$enddate.get_inc_log(1).$otype.get_inc_log(1).$department.get_inc_log(1).$participation.get_inc_log(1).$person.get_inc_log(1).$note.get_inc_log(1).$type;
	$title='新增工作计划';
	get_oa_log_dbadd($id,$content,$title,12,$_USER->id);
    goto_page('admin.php?ac=index&fileurl=plan');

}
?>